package com.example.auth.config.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.util.Collections;

/**
 * @program: cloud-alibaba-demo
 * @description:
 * @author: qd.yt
 * @create: 2021-08-19 23:34
 **/
@Configuration
public class RestTemplateConfiguration {

    @Autowired
    TokenInterceptor tokenInterceptor;

    @Bean
    public RestTemplate restTemplate()
    {
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.setInterceptors(Collections.singletonList(tokenInterceptor));
        return restTemplate;
    }

}
